package com.example.sxt_practise.java并发编程;

/**
 * @author gaofeng
 * @date 2022年02月17日 23:23
 */
public class Test {
}

class People extends Thread {
    @Override
    public void run() {
       GuardedObject guardedObject = MailBox.createGuardedObject() ;
        System.out.println("开始授信");
        Object response = guardedObject.getResponse(5000);
        System.out.println("完成授信,内容是 + " + response);
    }
}

class PostMan extends Thread {

    private int id ;
    private String mail ;

    public PostMan(int id, String mail) {
        this.id = id ;
        this.mail = mail ;
    }

    @Override
    public void run() {
        GuardedObject guardedObject = MailBox.createGuardedObject();
        guardedObject.complete(mail);
    }
}
